package WeeklyContest.BiWeek;

import java.util.*;

/**
 * @author:gao
 * @date:2020/7/11
 * @time:22:28
 * @version:0.0.1
 * @description:none
 */

public class B30 {
    public static void main(String[] args) {

    }
}

class Solution10211{
    public String reformatDate(String date) {
        String[] s = date.split(" ");
        StringBuilder sb = new StringBuilder("");
        sb.append(s[2] + "-");
        switch (s[1]) {
            //{"Jan", "Feb", "Mar", "Apr",
            // "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
            case "Jan":
                sb.append("01" + "-");
                break;
            case "Feb":
                sb.append("02" + "-");
                break;
            case "Mar":
                sb.append("03-");
                break;
            case "Apr":
                sb.append("04-");
                break;
            case "May":
                sb.append("05-");
                break;
            case "Jun":
                sb.append("06-");
                break;
            case "Jul":
                sb.append("07-");
                break;
            case "Aug":
                sb.append("08-");
                break;
            case "Sep":
                sb.append("09-");
                break;
            case "Oct":
                sb.append("10-");
                break;
            case "Nov":
                sb.append("11-");
                break;
            case "Dec":
                sb.append("12-");
                break;

        }
        if(s[0].charAt(1)>='0'&&s[0].charAt(1)<='9'){
            sb.append(s[0].substring(0,2));
        }else{
            sb.append("0"+s[0].charAt(0));
        }
        return sb.toString();
    }
}

//5445. 子数组和排序后的区间和
class Solution {
    public int rangeSum(int[] nums, int n, int left, int right) {
        int mod = (int) (1e9 + 7);
        int[] prefix = new int[nums.length+1];
        for(int i=1;i<=nums.length;i++){
            prefix[i]=prefix[i-1]+nums[i-1];
        }
        int ans =0;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i <=nums.length ; i++) {
            for (int j = i+1; j <=nums.length ; j++) {
                int subn = prefix[j]-prefix[i];
                list.add(subn);
            }
        }
        Collections.sort(list);
        for (int i = left-1; i <=right-1 ; i++) {
            ans= (ans+list.get(i))%mod;
        }
        return ans;
    }
}